package com.xyy.saas.payment.service;

import com.xyy.saas.payment.dao.model.*;

import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;

/**
 * @author wangtianqi
 * @date 2020/5/13 15:03
 */
public interface OrderService {

    PayResultOrder selectPayResultOrderByPayNoAndChannel(String payNo, String channel);

    List<PayResultOrder> selectPayResultOrderListByPayNo(String payNo);

    List<PayResultOrder> selectPayResultOrderListByPayNos(List<String> payNos);

    int insertPayResultOrderSelective(PayResultOrder payResultOrder);

    List<PayResultOrder> selectPayResultOrderListByCondition(String payNo, String businessOrderType, String payer, String channelTransactionNo, String channel, Date beginTime, Date endTime, int page, int pageSize);

    int selectPayResultOrderCountByCondition(String payNo, String businessOrderType, String payer, String channelTransactionNo, String channel, Date beginTime, Date endTime);

    List<PrePayOrder> getPrePayOrderByBusinessOrderNo(String businessOrderNo);

    PrePayOrder getPrePayOrderByPayNo(String payNo);

    List<PrePayOrder> getPrePayOrderByPayNos(List<String> payNos);

    PayResultOrder selectByChannelChargeNo(String channelChargeNo);

    List<RefundOrder> selectRefundOrderListByCondition(String payNo, String businessOrderType, String payer, String channelTransactionNo, String channel,  Date beginTime, Date endTime, int page, int pageSize);

    int selectRefundOrderCountByCondition(String payNo, String businessOrderType, String payer, String channelTransactionNo, String channel, Date beginTime, Date endTime);

    List<RefundOrder> selectRefundOrderListByPayNo(String payNo);

    List<RefundOrder> selectNoneRoyaltyRefundOrders(LocalDateTime beginTime, LocalDateTime endTime);

    /**
     * 更新订单的状态
     * @param record
     * @return
     */
    int updatePrePayOrderById(PrePayOrder record);

    /**
     * 根据退款号查询支付单号
     * @param refundNo
     * @return
     */
    RefundOrder selectByRefundNo(String refundNo);

    /**
     * 根据签约协议号查询预支付订单信息
     * @param contractCode
     * @return
     */
    List<PrePayOrder> selectByContractCode(String contractCode);

    void batchInsertRepayPlans(List<OrderTransDataPo> transDataPos, List<LoanRepayPlanPo> repayPlanPos, List<LoanRepayPlanDetailPo> detailPos);
}
